package com.cgw.game.ui;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import androidx.appcompat.widget.Toolbar;
import android.view.View;

import com.cgw.game.R;
import com.cgw.game.view.banner.BasicPagerAdapter;
import com.cgw.game.view.banner.CyclePageTransformer;
import com.cgw.game.view.banner.SimpleViewPager;

public class CycleBannerActivity extends AppCompatActivity {
    SimpleViewPager simpleSlider;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_cycle_banner);
        Toolbar toolbar = findViewById(R.id.toolbar);
        toolbar.setTitle(getIntent().getStringExtra("title"));
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);//左侧添加一个默认的返回图标
        getSupportActionBar().setHomeButtonEnabled(true); //设置返回键可用
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();//返回
            }
        });
        simpleSlider = findViewById(R.id.viewPager);
        simpleSlider.setAdapter(new BasicPagerAdapter(this));
        simpleSlider.setPageTransformer(new CyclePageTransformer(simpleSlider));//翻页动画*/
    }
}
